﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers;
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ITXHWEB.Controllers
{
    public partial class ABFOLGEController
    {


        [ChildActionOnly]
        public ActionResult SEND(string returnUrl)
        {
            ModelState.Clear();
            ViewBag.ReturnUrl = returnUrl;
            Helper.GetSTime(ref date, ref time, ref stime);
            MABF.DTEND = date;
            MABF.TMEND = stime;
            return PartialView(MABF);
        }
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult SEND(ABFOLGEModel model, string returnUrl)
        {
            try
            {
                ModelState.Clear();
                ABFEND(model);
            }
            catch (Exception ex)
            {
                INFO = ex.Message;
                Tracer.Error(ex.StackTrace, ex);
            }
            return RedirectToAction(MAPP, MAPP);
        }
        //连续式处理End/OK
        public void ABFEND(ABFOLGEModel model)
        {
            MABF.QTY =(double) 0.0;
            PREPAREPM(model);
            PM["QTY"] = (double)0.0;
            PM["PDCTYPE"] = MABF.PDCTYPE;
            PM["KSLTYPE"] = "STEPEND"; 
            PM["PDCDATE"] = MABF.DTEND;
            PM["PDCTIMES"] = MABF.TMEND;
            PM["PDCTIMET"] = MABF.TMEND;
            PM["PDCTIME"] = MABF.TMSTART;
            PM["TP"] = MABF.MKFTP;
            VHP.ABP.SHIFT(PM);
            STOPAM();
            VHP.ABP.PDC(PM); 
            StartNewJob();
        }
    }
}
